home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Add-On
/
Workbench Add-On - Volume 1.iso
/
BBS-Archive
/
Comm
/
AmiTCP30b2.lha
/
src
/
appl
/
napsaterm
/
nifty.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-14
|
5KB
|
143 lines
/* $Id: nifty.h,v 3.3 1994/05/14 12:37:26 ppessi Exp $
*
* nifty.h -- useful macros, etc.
*
* Authors: Chris Newman, ppessi <Pekka.Pessi@hut.fi>
*
* Copyright (c) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
* Helsinki University of Technology, Finland.
* All rights reserved.
*
* See file COPYING for conditions to copy, modify and use this program.
*
* Copyright 1988, Chris Newman
* All Rights Reserved
* Permission is granted to copy, modify, and use this as long
* as this notice remains intact. This is a nifty program.
*
* Some of these #defines were swiped from various places
*
* DISCLAIMER: the author (and maintainer) of this program is not responsible
* for any damage or other problems caused by it.
*/
#ifndef NIFTY_H
#define NIFTY_H
#define PROGNAME "Napsaterm"
extern const char ProgName[];
#ifndef NAPSA_CONFIG_H
#include "config.h"
#endif
/* types */
#define Boolean int
typedef char BOOLEAN;
typedef unsigned short ushort;
typedef unsigned char uchar;
/* constants */
#undef CTRL
#define CTRL(a) ((a) & 0x1f)
#define CTRL8(a) ((a) & 0x1f | 0x80)
#define ESC '\033'
#define DEL '\177'
/* bound and limit macros */
#define SLIMIT(a, b) ((a) >= (b) ? ((a) = (b) - 1) : (a))
#define SLIMITCK(a, b) if ((a) >= (b)) (a) = (b) - 1
#define MAXBOUND(a, b) ((a) > (b) ? (a) = (b): (a))
#define MAXBOUNDCK(a, b) if ((a) > (b)) (a) = (b)
#define MINBOUND(a, b) ((a) < (b) ? (a) = (b): (a))
#define MINBOUNDCK(a, b) if ((a) < (b)) (a) = (b)
#define BOUNDS(a, l, h) ((a) < (l) ? (a) = (l) : ((a) > (h) ? (a) = (h) : (a)))
#define BOUNDSCK(a, l, h) if ((a) < (l)) (a) = (l); else if ((a) > (h)) (a) = (h)
/* useful macros */
#undef ABS
#undef MIN
#undef MAX
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define XSWAP(a, b) ((a) ^= (b), (b) ^= (a), (a) ^= (b))
#define SWAP(a, b) {register int xxx = a; a = b; b = xxx;}
#define XOR(a, b) ( ((a) ? 1 : 0) ^ ((b) ? 1 : 0) )
/* case macros */
#define ISDIGIT '0': case '1': case '2': case '3': case '4': case '5': \
case '6': case '7': case '8': case '9'
#define ISUPPER 'A': case 'B': case 'C': case 'D': case 'E': case 'F': \
case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': \
case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': \
case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z'
#define ISLOWER 'a': case 'b': case 'c': case 'd': case 'e': case 'f': \
case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': \
case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': \
case 'u': case 'v': case 'w': case 'x': case 'y': case 'z'
#define ISALPHA ISUPPER: case ISLOWER
#define PRINTABLE ' ': case '!': case '"': case '#': case '$': case '%': \
case '&': case'\'': case '(': case ')': case '*': case '+': case ',': \
case '-': case '.': case '/': case ':': case ';': case ISDIGIT: \
case '<': case '=': case '>': case '?': case '@': case ISUPPER: \
case '[': case'\\': case ']': case '^': case '_': case '`': \
case ISLOWER: case '{': case '|': case '}': case '~'
/*
* General prototypes
*/
void ClipClose(void); /* clip.c */
int ClipCut(char * string);
long ClipPaste(char * buf, long max);
char *itos(long); /* misc.c */
int lstrncmp(register char * str1, register char * str2, register int len);
void udelay(unsigned long val);
extern char MEMORY_ERROR_MSG[]; /* napsaterm.c */
extern BOOLEAN started_from_workbench;
int write_to_tty(char * buf, int count);
void amigainit(void);
void amigaquit(void);
void vtreport(void); /* emulate.c */
void vtstyle(int c);
void terminalMode(int num, int private, int on);
int decode_escapes(int c);
void termout(char * text, int count);
void waitToEnd(void); /* wimp.c */
void setnewtitle(void);
void perror(const char *banner);
void herror(const char *banner, const char *error);
void fatalError(const char *s, ...);
/* Added by RKNOP for tek4010.c */
#ifdef TEKTRONICS
extern int tekmode;
extern long tekwinmask;
void set_tekmode(unsigned short);
void vt100_tek(void);
void tek_vt100(void);
void graph_clear(void);
char *tekout(char *,char *); /* Returns new pointer to where in */
/* stream we stopped */
void tekpoll(void);
void closetekwin(void);
#define TEK_POINT 0
#define TEK_VECTOR 1
#define TEK_INCR 2
#define TEK_ALPHA 3
#define TEK_GIN 4
#define TEK_BLOCK 5
#endif
/* End of RKNOP added */
#define DEBUG(x) puts(x)
#endif